<ui:component xmlns:ui="http://java.sun.com/jsf/facelets"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:c="http://java.sun.com/jstl/core"
              xmlns:rich="http://richfaces.org/rich"
              xmlns:a4j="http://richfaces.org/a4j"
              xmlns:msn="http://www.contact.messanger.com/contacts/msn/ui"
              xmlns:core="http://www.contact.core.com/contacts/core/ui"
        >
    <a4j:outputPanel layout="none">
       <h:form id="form_chatUserList">
            <rich:panel header="User List" style="overflow:auto;border:0;" rendered="#{not (chatSessionBean.viewingRoom eq null)}">

                    <rich:contextMenu attached="false" id="menu" submitMode="ajax" event="onmouseover">
                        <rich:menuItem value="#{resources.userchatPChatContex}" action="#{createChatBean.createQuickRoom}"
                                       ajaxSingle="true">
                            <a4j:actionparam name="mail" assignTo="#{createChatBean.invitedUserMail}"
                                             value="{mail}"/>
                        </rich:menuItem>
                        <rich:menuGroup value="Actions">
                            <rich:menuItem value="#{resources.userchatProfileContext}"
                                           action="#{accountBean.friendProfileByInformationIdFromA4j}"
                                           ajaxSingle="true">
                                <a4j:actionparam name="info" value="{id}"
                                                 assignTo="#{accountBean.informationIdForView}"/>
                            </rich:menuItem>
                            <rich:menuItem value="#{resources.userchatSMessageContext}"
                                           oncomplete="Richfaces.showModalPanel('sendMessageModalPanel'); #{rich:element('messageReceiver')}.value='{mail}';"
                                           ajaxSingle="true">
                            </rich:menuItem>
                            <c:if test="#{chatSessionBean.viewingRoom.ownerActiveUser.info.id eq profileSessionBean.information.id}">
                                <rich:menuSeparator/>
                                <rich:menuItem value="#{resources.userchatOwnershipContext}"
                                               action="#{chatRequestBean.giveOwnership}" ajaxSingle="true">
                                    <a4j:actionparam name="mail" assignTo="#{chatRequestBean.actionUserMail}"
                                                     value="{mail}"/>
                                    <a4j:actionparam name="key" assignTo="#{chatRequestBean.roomKey}"
                                                     value="{key}"/>
                                </rich:menuItem>
                                <rich:menuItem value="#{resources.userchatKickoutContext}" action="#{chatRequestBean.kickUser}"
                                               ajaxSingle="true">
                                    <a4j:actionparam name="mail" assignTo="#{chatRequestBean.actionUserMail}"
                                                     value="{mail}"/>
                                    <a4j:actionparam name="key" assignTo="#{chatRequestBean.roomKey}"
                                                     value="{key}"/>
                                </rich:menuItem>
                            </c:if>
                        </rich:menuGroup>
                    </rich:contextMenu>
                    <rich:dataTable value="#{chatSessionBean.viewingRoom.activeUsers}" var="user" width="100%">
                        <rich:column width="30px" style="padding: 0px;cursor:pointer;">
                            <core:pictureForView pictureKey="photoprofile_#{user.info.id}"
                                                 style="width:30px;height:30px;"
                                                 informationId="#{user.info.id}"/>
                        </rich:column>
                        <rich:column style="cursor:pointer;">
                            <h:outputText value=" #{user.info.firstName} #{user.info.lastName}"/>
                        </rich:column>
                        <rich:componentControl event="onRowClick" for="#{rich:clientId('menu')}" operation="show"
                                               rendered="#{not (user.info.id eq profileSessionBean.information.id)}">
                            <f:param value="#{user.info.mailId}" name="mail"/>
                            <f:param value="#{user.info.firstName}" name="name"/>
                            <f:param value="#{user.info.id}" name="id"/>
                            <f:param value="#{chatSessionBean.viewingRoom.uniqueKey}" name="key"/>
                        </rich:componentControl>
                    </rich:dataTable>
            </rich:panel>
        </h:form>
    </a4j:outputPanel>
</ui:component>